"""
整个项目的前置后置操作
"""
import os
import pytest
from config.config import env


@pytest.fixture(scope='session')
def environment(request):
    print(request.config)
    get_ini_env = request.config.getoption('env') or request.config.getini('env')
    print(f"输出的值{get_ini_env}")
    if get_ini_env:
        return env.get(get_ini_env, "环境不存在！")


def pytest_addoption(parser):
    parser.addini("env", help="change environment.")
    parser.addoption(
        "--env",
        default=None,
        help="change environment."
    )